//////////////////////////////////////////////////////////////////////////////////
//	 Copyright 2011 by Yosef Grabivker, ryuho@homenetworksoft.com
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.
//////////////////////////////////////////////////////////////////////////////////

#ifndef CONECTWIZARD_H_
#define CONECTWIZARD_H_

#include <wx/wizard.h>
#include "def.h"

class CConectWizard: public wxWizard
{
public:
							CConectWizard(wxFrame* pFrame);
							~CConectWizard();
	
	void					GetConParams(CONPARAMS& params);
	
	void					SetConParams(CONPARAMS& params) { m_params = params; }
	CONPARAMS				GetConParams()					{ return m_params;   }

	bool					CheckHost();
	bool					CheckAll(wxString& strErr, wxString& strSession, int& errorID);

	class wxWizardPageSimple* GetFirstPage() { return m_pFirstPage; }
	class wxWizardPageSimple* GetSSHWizard() { return m_pSSHPage; }
	class wxWizardPageSimple* GetTelnetWizard() { return m_pTelnetPage; }

protected:
	void					OnBack(wxCommandEvent& event);
	DECLARE_EVENT_TABLE()
	
private:	
	CONPARAMS 				m_params;
	class wxWizardPageSimple* m_pFirstPage;
	class wxWizardPageSimple* m_pTelnetPage;
	class wxWizardPageSimple* m_pSSHPage;
	
};


class CConParamInputPage: public wxWizardPageSimple
{
public:
							CConParamInputPage(CConectWizard *parent);
    virtual bool			TransferDataFromWindow();

protected:
	void					OnTogleAdvanced(wxCommandEvent& event);
	DECLARE_EVENT_TABLE()

private:
	class wxFlexGridSizer*	m_fgs;
	class wxTextCtrl*		m_ptcUser;
	class wxTextCtrl*		m_ptcPassw;
	class CConectWizard*	m_parent;

	class wxStaticText*		m_plbWelcome;
	class wxStaticText*		m_plbShell;
	class wxCheckBox*		m_pcbHTTP;
	class wxTextCtrl*		m_pedtHTTP;

	class wxTextCtrl*		m_pedtWelcome;
	class wxTextCtrl*		m_pedtShell;
	class wxCheckBox*		m_pAdvanced;
};

class CSSHParamInputPage: public wxWizardPageSimple
{
public:
							CSSHParamInputPage(CConectWizard *parent);
    virtual bool			TransferDataFromWindow();

protected:
	void					OnTogleAdvanced(wxCommandEvent& event);
	void					OnPubKeyFile(wxCommandEvent& event);
	void					OnPrivKeyFile(wxCommandEvent& event);
	DECLARE_EVENT_TABLE()


private:
	class wxBoxSizer*		m_hbox;
	class wxFlexGridSizer*  m_fgsUserPass;
	class wxFlexGridSizer*  m_fgsPKI;

	CONPARAMS				m_params;
	wxTextCtrl*				m_ptcUser;
	wxTextCtrl*				m_ptcPassw;
	CConectWizard*			m_parent;
	class wxCheckBox*		m_pAdvanced;
	//------------------------------------
	class wxTextCtrl*		m_ptcSSHUser;
	class wxStaticText*		m_plbPubKey;
	class wxTextCtrl*		m_pedtPubKey;
	class wxButton*			m_pBtnPubKey;

	class wxStaticText*		m_plbPrivKey;
	class wxTextCtrl*		m_pedtPrivKey;
	class wxButton*			m_pBtnPrivKey;

	class wxStaticText*		m_plbPassPhraze;
	class wxTextCtrl*		m_pedtPassPhraze;
};



class CRouterAddressInputPage: public wxWizardPageSimple
{
public:
							CRouterAddressInputPage(CConectWizard *parent);
    virtual bool			TransferDataFromWindow();

protected:
	void					OnProtoChanged(wxCommandEvent&);
	DECLARE_EVENT_TABLE()

private:
	class wxComboBox*		m_pcProtocol;
	class wxTextCtrl*		m_ptcIP;
	class wxTextCtrl*		m_ptcPort;
	class CConectWizard*	m_parent;

	wxString				m_strPort;
};


class CConParamFinishPage: public wxWizardPageSimple
{
public:
	CConParamFinishPage(CConectWizard *parent);
    

private:
	bool					m_bConOk;
	CConectWizard*			m_parent;
};

#endif /*CONECTWIZARD_H_*/
